<template>
	<el-dialog title="打印预览" v-model="visible" customClass="customWidth" destroy-on-close @closed="$emit('closed')">
		<div ref="printMain" id="print-html" v-html="htmlCode"></div>
	</el-dialog>
</template>
<script>
import print from '@/utils/print'
export default {
	emits: ['success', 'closed'],
	components: {},
	data() {
		return {
			visible: false,
			isSaveing: false,
			isShowMsg: false,
			htmlCode: '',
		}
	},
	mounted() {
	},
	methods: {
		open() {
			this.visible = true;
			return this
		},
		setData(data) {
			this.htmlCode = data;
			this.$nextTick(() => {
			print(this.$refs.printMain)
			})
		}
	}
}
</script>

<style>
.customWidth {
	width: 60%;
}
</style>
